package com.zer0.tga.entity.abstractentity;

import com.zer0.tga.entity.Entity;
import com.zer0.tga.math.Coordinate;
import com.zer0.tga.math.Direction;

public class Teleporter extends AbstractEntity{
	
	
	
	public boolean active;
	
	

	public Teleporter(Coordinate pos, Coordinate rad, boolean active)
	{
		this.setPositionAndRadius(pos, rad);
		this.active = active;
	}
	
	public boolean blocks(Entity e) {
	/*	if(e instanceof Teemo)
			return false;
		else*/
			return true;
	}
	
	public boolean teleport(Entity e) {
		// TODO Auto-generated method stub
		
		if(level.getCurrentRoom().mobCount == 0)
		{
				// find which edge collision happened from, then trigger the room change
				if(this.position.x + this.radius.x < e.position.x) 		// x1 side
				{
		      		level.roomChange = Direction.WEST;	
		      	}
				else if(this.position.x - this.radius.x > e.position.x) // x0 side
				{
					level.roomChange = Direction.EAST;
				}
				else if(this.position.y + this.radius.y < e.position.y) // y1 side
				{
					level.roomChange = Direction.NORTH;
				}
				else if(this.position.y - this.radius.y > e.position.y) // y0 side
				{
					level.roomChange = Direction.SOUTH;
				}
		}
		return false;
	}



	public boolean teleport(Entity e, Direction dir) {
		// TODO Auto-generated method stub
		
		if(level.getCurrentRoom().mobCount == 0)
		{
			level.roomChange = dir;
			/*	// find which edge collision happened from, then trigger the room change
				if(this.position.x + this.radius.x < e.position.x) 		// x1 side
				{
		      		level.roomChange = Direction.WEST;	
		      	}
				else if(this.position.x - this.radius.x > e.position.x) // x0 side
				{
					level.roomChange = Direction.EAST;
				}
				else if(this.position.y + this.radius.y < e.position.y) // y1 side
				{
					level.roomChange = Direction.NORTH;
				}
				else if(this.position.y - this.radius.y > e.position.y) // y0 side
				{
					level.roomChange = Direction.SOUTH;
				}*/
		}
		return false;
	}
	
}
